<template>
    <view class="auth-container">
        <view class="auth-content">
            <view class="auth-header">
                <image class="auth-logo" src="/static/logo.png" mode="aspectFit"></image>
                <view class="auth-title">记账小程序</view>
            </view>
            <view class="auth-info">
                <view class="auth-desc">申请获取以下权限：</view>
                <view class="auth-item">
                    <text class="dot">•</text>
                    <text>获取您的公开信息（头像、昵称等）</text>
                </view>
            </view>
            <button class="auth-btn" type="primary" @tap="handleAuth">授权登录</button>
        </view>
    </view>
</template>

<style>
.auth-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    padding: 0 30rpx;
}

.auth-content {
    width: 100%;
    padding: 40rpx;
    background-color: #ffffff;
    border-radius: 16rpx;
    box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 40rpx;
}

.auth-logo {
    width: 128rpx;
    height: 128rpx;
    margin-bottom: 20rpx;
}

.auth-title {
    font-size: 36rpx;
    font-weight: bold;
    color: #333;
}

.auth-info {
    margin-bottom: 40rpx;
}

.auth-desc {
    font-size: 30rpx;
    color: #333;
    margin-bottom: 20rpx;
}

.auth-item {
    display: flex;
    align-items: center;
    font-size: 28rpx;
    color: #666;
}

.dot {
    margin-right: 10rpx;
    color: #999;
}

.auth-btn {
    width: 100% !important;
    height: 88rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    border-radius: 44rpx;
    background-color: #07c160;
    font-weight: normal;
}

.auth-btn::after {
    border: none;
}
</style>

<script>
export default {
    data() {
        return {
			openId: ''
		};
    },
	onLoad(options) {
		if(options && options.openId){
			this.openId = options.openId;
		}
	},	
    methods: {
        async handleAuth() {
			if(this.openId){
				uni.redirectTo({
				    url: `/pages/auth/login?openId=${this.openId}`
				});
			}else{
				console.warn('获取openId失败');
			}
        },
        
    },
};
</script>
